package com.thread;

import java.util.concurrent.TimeUnit;

public class SynArea implements Runnable{
	private int age = 1;
	
	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	@Override
	public void run() {
		//synchronized (this) {
			age++;
			try {
				TimeUnit.SECONDS.sleep(20L);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}		
		//}
	}
	
	public static void main(String[] args) throws InterruptedException {
		SynArea sa = new SynArea();
		Thread t = new Thread(sa);
		t.start();
		Thread.sleep(100);
		int age2 = sa.getAge();
		System.out.println(age2);
		
	}

}
